package com.allen.study.infrastructure.persistence.assembler;

import com.allen.study.application.api.response.ApprovalRecordQueryResponse;
import com.allen.study.domain.entity.ApprovalRecord;
import com.allen.study.infrastructure.persistence.assembler.mapper.IApprovalRecordPOStructMapper;
import com.allen.study.infrastructure.persistence.po.ApprovalRecordPO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 审批记录表类型转换
 *
 * @author AllenSun
 * @since 2025-04-23 20:46
 */
@Component
public class ApprovalRecordPOAssembler {

    /**
     * 审批记录表持久化对象装配
     *
     * @param approvalRecord 审批记录表实体
     * @return 审批记录表持久化对象
     */
    public ApprovalRecordPO assembler(ApprovalRecord approvalRecord) {
        return IApprovalRecordPOStructMapper.INSTANCE.fromEntity(approvalRecord);
    }

    /**
     * 审批记录表持久化对象装配
     *
     * @param approvalRecordList 审批记录表实体
     * @return 审批记录表持久化对象
     */
    public List<ApprovalRecordPO> assembler(List<ApprovalRecord> approvalRecordList) {
        return IApprovalRecordPOStructMapper.INSTANCE.fromEntity(approvalRecordList);
    }

    /**
     * 审批记录表持久化对象 转 审批记录表实体
     *
     * @param approvalRecordPO 审批记录表持久化对象
     * @return 审批记录表实体
     */
    public ApprovalRecord toEntity(ApprovalRecordPO approvalRecordPO) {
        return IApprovalRecordPOStructMapper.INSTANCE.toEntity(approvalRecordPO);
    }

    /**
     * 审批记录表持久化对象列表  转 审批记录表实体列表
     *
     * @param approvalRecordPOList 审批记录表持久化对象
     * @return 审批记录表实体
     */
    public List<ApprovalRecord> toEntity(List<ApprovalRecordPO> approvalRecordPOList) {
        return IApprovalRecordPOStructMapper.INSTANCE.toEntity(approvalRecordPOList);
    }

    /**
     * 审批记录表持久化对象 转 审批记录表查询响应数据传输对象
     *
     * @param approvalRecordPO 审批记录表持久化对象
     * @return 审批记录表查询响应数据传输对象
     */
    public ApprovalRecordQueryResponse toQueryResponse(ApprovalRecordPO approvalRecordPO) {
        return IApprovalRecordPOStructMapper.INSTANCE.toQueryResponse(approvalRecordPO);
    }

    /**
     * 审批记录表持久化对象列表 转 审批记录表查询响应数据传输对象列表
     *
     * @param approvalRecordPOList 审批记录表持久化对象列表
     * @return 审批记录表查询响应数据传输对象列表
     */
    public List<ApprovalRecordQueryResponse> toQueryResponse(List<ApprovalRecordPO> approvalRecordPOList) {
        return IApprovalRecordPOStructMapper.INSTANCE.toQueryResponse(approvalRecordPOList);
    }
}
